;;; packages - package definitions for GNU Guix
;;; Copyright (C) 2016, 2017 ng0
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Affero General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (ng0 packages lpc)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (ice-9 match)
  #:use-module (guix utils)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages llvm)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages gdb)
  #:use-module (gnu packages image)
  #:use-module (gnu packages multiprecision)
  #:use-module (gnu packages nettle)
  #:use-module (gnu packages pcre)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages video)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages kerberos)
  #:use-module (gnu packages assembly)
  #:use-module (gnu packages pkg-config))

(define-public pike
  (package
    (name "pike")
    (version "8.0.276")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://pike.lysator.liu.se/pub/pike/"
                                  "latest-stable/Pike-v" version ".tar.gz"))
              (sha256
               (base32
                "1bl5jl93ixf1p3cybvsf53014z6iansf4xcj9r75m4n8sm1hharx"))))
    (build-system gnu-build-system)
    (arguments
     `(#:make-flags
       (list "CC=gcc"
             (string-append "prefix="
                            (assoc-ref %outputs "out")))
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-before 'build 'patch-makefile
           (lambda _
             (substitute* "Makefile"
               (("/bin/bash") (which "bash"))
               (("/bin/sh") (which "sh"))
               (("^OS=") "# OS recognition disabled by Guix")))))))
         ;; (add-before 'build 'patch-configure
         ;;   (lambda _
         ;;     (patch-shebang "build/posix_to_native.sh" (which "sh")))))))
    (inputs
     `(("clang" ,clang)
       ("gmp" ,gmp)
       ("mysql" ,mysql)
       ("nettle" ,nettle)
       ("gdbm" ,gdbm)
       ("bison" ,bison)
       ("yasm" ,yasm)
       ("gnu-gettext" ,gnu-gettext)
       ("perl" ,perl)
       ("bash" ,bash)
       ("gdb" ,gdb)
       ("pcre" ,pcre)
       ("freetype" ,freetype)
       ("zlib" ,zlib)
       ("doxygen" ,doxygen)
       ("readline" ,readline)
       ("libjpeg" ,libjpeg)
       ("libtiff" ,libtiff)
       ("ffmpeg" ,ffmpeg)
       ("freeglut" ,freeglut)
       ("mit-krb5" ,mit-krb5)
       ("fftw" ,fftw)
       ("autoconf" ,autoconf)
       ("automake" ,automake)
       ("gzip" ,gzip)))
    (license (list license:gpl2
                   license:lgpl2.1
                   license:mpl1.1))
    (home-page "http://pike.lysator.liu.se")
    (description
     "Pike is an interpreted, object-oriented, dynamic programming language
with a syntax similar to C.  It includes many powerful data types and a
module system that, for instance, provides image manipulation together,
with support for graphics formats like SVG, JPG, PNG, GIF, XCF and many
others, database connectivity, advanced cryptography, XML/HTML parsers and others.")
    (synopsis "Dynamic programming language with a syntax similar to C++")))
